package com.ruoyi.gb.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.gb.mapper.SmParticularsMapper;
import com.ruoyi.gb.domain.SmParticulars;
import com.ruoyi.gb.service.ISmParticularsService;

/**
 * 项目基础信息Service业务层处理
 *
 * @author rww
 * @date 2024-05-21
 */
@Service
public class SmParticularsServiceImpl implements ISmParticularsService
{
    @Autowired
    private SmParticularsMapper smParticularsMapper;

    /**
     * 查询项目基础信息
     *
     * @param id 项目基础信息主键
     * @return 项目基础信息
     */
    @Override
    public SmParticulars selectSmParticularsById(Long id)
    {
        return smParticularsMapper.selectSmParticularsById(id);
    }
    @Override
    public SmParticulars selectSmParticularsByPId(String pid){
        return smParticularsMapper.selectSmParticularsByPId(pid);
    }
    /**
     * 查询项目基础信息列表
     *
     * @param smParticulars 项目基础信息
     * @return 项目基础信息
     */
    @Override
    public List<SmParticulars> selectSmParticularsList(SmParticulars smParticulars)
    {
        return smParticularsMapper.selectSmParticularsList(smParticulars);
    }

    /**
     * 新增项目基础信息
     *
     * @param smParticulars 项目基础信息
     * @return 结果
     */
    @Override
    public int insertSmParticulars(SmParticulars smParticulars)
    {
        return smParticularsMapper.insertSmParticulars(smParticulars);
    }

    /**
     * 修改项目基础信息
     *
     * @param smParticulars 项目基础信息
     * @return 结果
     */
    @Override
    public int updateSmParticulars(SmParticulars smParticulars)
    {
        return smParticularsMapper.updateSmParticulars(smParticulars);
    }

    /**
     * 批量删除项目基础信息
     *
     * @param ids 需要删除的项目基础信息主键
     * @return 结果
     */
    @Override
    public int deleteSmParticularsByIds(Long[] ids)
    {
        return smParticularsMapper.deleteSmParticularsByIds(ids);
    }

    /**
     * 删除项目基础信息信息
     *
     * @param id 项目基础信息主键
     * @return 结果
     */
    @Override
    public int deleteSmParticularsById(Long id)
    {
        return smParticularsMapper.deleteSmParticularsById(id);
    }

    @Override
    public List<String> getAllManagedDept(){
        return smParticularsMapper.getAllDept();
    }

    @Override
    public List<Map<String,Object>> selectCityArea(SmParticulars smParticulars){
        return smParticularsMapper.selectCityArea(smParticulars);
    }

    @Override
    public List<SmParticulars> countAreaList(SmParticulars smParticulars){
        if(smParticulars.getLevel().equals("1")){
            //传省的编码，按市区统计
            return smParticularsMapper.countAreaListByProvinceCode(smParticulars);
        }else if(smParticulars.getLevel().equals("2")){
            //传市的编码，按县统计
            return smParticularsMapper.countAreaListByCityCode(smParticulars);
        }else{
            //按传入的县编码，按县统计
            return smParticularsMapper.countAreaListByXianCode(smParticulars);
        }
    }

    @Override
    public SmParticulars countAreaProjectCount(SmParticulars smParticulars){
        return smParticularsMapper.countAreaProjectCount(smParticulars);
    }

}
